<!--
Copyright 2014 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<link rel="import" href="ct-builder-grid.html">
<link rel="import" href="ct-commit-list.html">
<link rel="import" href="ct-test-list.html">

<polymer-element name="ct-step-failure-card" attributes="group commitLog">
  <template>
    <style>
      :host {
        display: flex;
      }

      :host > * {
        flex: 1;
      }

      ct-test-list,
      ct-builder-grid {
        display: block;
        margin-bottom: 10px;
        min-height: 24px;
      }

      ct-commit-list {
        margin-left: 25px;
      }

      @media (max-width: 800px) {
        :host {
          flex-direction: column;
        }

        ct-commit-list {
          margin-left: 0px;
        }
      }
    </style>
    <div>
      <ct-builder-grid builderList="{{ group.builderList }}"></ct-builder-grid>
      <ct-test-list tests="{{ group.failures }}"></ct-test-list>
    </div>
    <ct-commit-list commitList="{{ group.commitList }}" suspectedCLsByRepo="{{ group.suspectedCLsByRepo }}"></ct-commit-list>
  </template>
  <script>
    Polymer({
      group: null,
      repositories: null,
      _builderList: null,

      observe: {
        group: '_updateCommitList',
        repositories: '_updateCommitList',
      },

      _updateCommitList: function() {
        if (this.group && this.group.commitList && this.repositories)
          this.group.commitList.update(this.repositories);
      },
    });
  </script>
</polymer-element>


